package cn.shentianlan.controller;

import cn.shentianlan.criteria.ClassCriteria;
import cn.shentianlan.domain.dto.ClassDTO;
import cn.shentianlan.service.ClassService;
import cn.shentianlan.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 陈俊源
 * @Description TODO
 * @Date 2021/4/18
 * @Version 1.0
 */
@RestController
@RequestMapping("/class")
public class ClassController {

    @Autowired
    private ClassService classService;

    @RequestMapping("/list")
    public Result findClassByCriteria(ClassCriteria classCriteria){
        Result result = classService.findClassByCriteria(classCriteria);
        return result;
    }

    @RequestMapping("/saveOrUpdateClass")
    public Result saveOrUpdateClass(ClassDTO classDTO){
        Result result = classService.saveOrUpdateClass(classDTO);
        return result;
    }

    @RequestMapping("/getClassById")
    public Result getClassById(Long id){
        Result result = classService.getClassById(id);
        return result;
    }

    @RequestMapping("/deleteClassById")
    public Result deleteClassById(Long id){
        Result result = classService.deleteClassById(id);
        return result;
    }
}
